#pragma once
//#include "WareEngineNameSpace.h"

BEGIN_WARE
class IEffect;
class IEffectProp;
class IEffectUnitProp;
END_WARE

#define			KEY_CENTER	0
#define			KEY_LEFT	1
#define			KEY_RIGHT	2

using namespace Ware;

// CEffectTrack
class CEffectTrack : public CStatic
{
	DECLARE_DYNAMIC(CEffectTrack)

public:
	CEffectTrack();
	virtual ~CEffectTrack();

	void			SetEffect( IEffect** ppEffect );

	void			DrawTrack( CDC* pDC, int32 nTrack, CRect& Rect, VBOOL bSeclected = VFALSE );
	void			DrawEffectUnit( CDC* pDC, int32 nY, float32 fStart, float32 fLenght, int32 nTotalWidth, IEffectUnitProp* pEffectunitProp );

	void			SetSelectedEffectUnit( CPoint& point );

	void			OnDraw();

	void			OnScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );

private:
	void			InsertTrack();
	void			RemoveTrack();
	void			AddEffectUnit();

	//////////////////////////////////////////////////////////////////////////
	int32			GetClientWidth();

private:

	IEffect**		m_ppEffect;
	IEffectProp*	m_pEffectProp;
	int32			m_nSeclected;

	int32			m_bSetEffectUnitTime;
	int32			m_nPriMoveKeySide;
	CPoint			m_MouseStartPoint;

	CScrollBar		m_VScroll;
	CFont			m_Font;
public:

	virtual void	PreSubclassWindow();
	virtual BOOL 	PreTranslateMessage(MSG* pMsg);

	void			 OnApplyEffectUnitProp();

protected:
	DECLARE_MESSAGE_MAP()
public:

	afx_msg void 	OnPropAddtrack();
	afx_msg void 	OnPropRemovetrack();
	afx_msg void 	OnPropAddeffectunit();

	afx_msg void 	OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void 	OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void 	OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void 	OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void 	OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg BOOL 	OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void 	OnPaint();
	afx_msg void 	OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void	OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void	OnRButtonUp(UINT nFlags, CPoint point);

	

};
